﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Data;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.IO;
using System.Windows.Markup;
using System.Xml;

namespace BAL.EstRec.UIHQ
{
    public class UIGridHQ
    {
        //public UIGridHQ()
        //{
        //     public StackPanel sPanel;
        //}
        ////public static StackPanel CargaDataGridHQ(StackPanel sPanel,DataTable dt)
        ////{
        ////    StackPanel pc;
        ////    CargaDataGrid(sPanel, dt);
        ////    return pc;
               
        ////}
        //public void  CargaDataGrid(StackPanel sPanel,DataTable dt)
        //{
        //    //for (int x = 0; x < dt.Rows.Count; x++)
        //    //{
        //    //    for (int y = 0; y < dt.Columns.Count; y++)
        //    //    {
                    

        //    //    }
        //    //}
        //    //return dt;
        //    if (sPanel.Children.Count > 0)
        //        sPanel.Children.RemoveAt(0); //Elimina el grid Anterior
        //    Grid dtg = new Grid();
        //    dtg.Name = "dtgSol";
        //    DefineColumnasGrid(dtg);
        //    DefineHeader(dtg);
        //    CargaRenglones(dtg, dt);
        //    sPanel.Children.Add(dtg);
        //}
        //private void DefineColumnasGrid(Grid dGrid)
        //{
        //    ColumnDefinition col1 = new ColumnDefinition();
        //    col1.Name = "CheckBox";
        //    col1.Width = new GridLength(20);

        //    ColumnDefinition col2 = new ColumnDefinition();
        //    col1.Name = "POS";
        //    col1.Width = new GridLength(100);

        //    ColumnDefinition col3 = new ColumnDefinition();
        //    col2.Name = "RECURSOS";
        //    col2.Width = new GridLength(100);

        //    ColumnDefinition col4 = new ColumnDefinition();
        //    col3.Name = "CANTIDAD";
        //    col3.Width = new GridLength(60);
        //    //DataGridLength(1, DataGridLengthUnitType.SizeToCells);
        //    dGrid.ColumnDefinitions.Add(col1);
        //    dGrid.ColumnDefinitions.Add(col2);
        //    dGrid.ColumnDefinitions.Add(col3);
        //    dGrid.ColumnDefinitions.Add(col4);
        //}
        //private void DefineHeader(Grid dGrid)
        //{
        //    //Agrega renglon de Encabezado
        //    RowDefinition row1 = new RowDefinition();
        //    row1.Name = "Header";
        //    dGrid.RowDefinitions.Add(row1);

        //    //Agrega texto a encabezado
        //    TextBlock txt1 = new TextBlock();
        //    txt1.Text = "";
        //    txt1.VerticalAlignment = VerticalAlignment.Center;
        //    txt1.HorizontalAlignment = HorizontalAlignment.Center;
        //    Grid.SetColumn(txt1, 0);
        //    Grid.SetRow(txt1, 0);

        //    TextBlock txt2 = new TextBlock();
        //    txt2.Text = "POS";
        //    txt2.VerticalAlignment = VerticalAlignment.Center;
        //    txt2.HorizontalAlignment = HorizontalAlignment.Center;
        //    Grid.SetColumn(txt2, 1);
        //    Grid.SetRow(txt2, 0);

        //    TextBlock txt3 = new TextBlock();
        //    txt3.Text = "RECURSOS";
        //    txt3.VerticalAlignment = VerticalAlignment.Center;
        //    txt3.HorizontalAlignment = HorizontalAlignment.Center;
        //    Grid.SetColumn(txt3, 2);
        //    Grid.SetRow(txt3, 0);

        //    TextBlock txt4 = new TextBlock();
        //    txt4.Text = "CANTIDAD";
        //    txt4.VerticalAlignment = VerticalAlignment.Center;
        //    txt4.HorizontalAlignment = HorizontalAlignment.Center;
        //    Grid.SetColumn(txt4, 3);
        //    Grid.SetRow(txt4, 0);

        //    dGrid.Children.Add(txt1);
        //    dGrid.Children.Add(txt2);
        //    dGrid.Children.Add(txt3);
        //    dGrid.Children.Add(txt4);
        //}
        //private void CargaRenglones(Grid dGrid, DataTable dtGrid)
        //{
        //    //DefineRenglones(dGrid, "Header");

        //    for (int x = 0; x < dtGrid.Rows.Count; x++)
        //    {
        //        //DefineRenglones(dGrid, "ID" + dtGrid.Rows[x]["ID_Datos_HQ"].ToString());
        //        //DefineEstiloRenglones(dGrid, x + 1, 0);

        //        for (int y = 0; y < dtGrid.Columns.Count; y++)
        //        {
        //            if (y == 0)
        //                DefineCheckBox(dGrid, x + 1, 0, "ID" + dtGrid.Rows[x]["ID_Datos_HQ"].ToString());
        //            //else
        //            //    DefineTextoCeldas(dGrid, x + 1, y, dtGrid.Rows[x][y].ToString());
        //        }
        //        //DefineEventoRenglones(dGrid, x + 1, 1, "ID" + dtGrid.Rows[x]["ID_Datos_HQ"].ToString());

        //    }
        //}
        //private void DefineCheckBox(Grid dGrid, int x, int y, string Texto)
        //{
        //    CheckBox chk = new CheckBox();
        //    chk.Name = Texto;
        //    chk.HorizontalAlignment = HorizontalAlignment.Center;
        //    chk.VerticalAlignment = VerticalAlignment.Center;

        //    Grid.SetColumn(chk, y);
        //    Grid.SetRow(chk, x);

        //    dGrid.Children.Add(chk);
        //}
    }
}
